const USER_ID = "user_id";
const USER_AUTH = "user_auth";

/**
 * 存储用户userID
 */
export const saveUserId = (userId) => {
    userId && window.localStorage.setItem(USER_ID, userId);
}

/**
 * 销毁userID
 */
export const destroyUserId = () => {
    window.localStorage.removeItem(USER_ID);
}

/**
 * 获取userID
 */
export const getUserId = () => {
    const userId = window.localStorage.getItem(USER_ID);
    if(userId == "undefined"){
        return null;
    }else {
        return userId;
    }
}

/**
 * 存储用户身份
 */
export const saveUserAuth = (userAuth) => {
    userAuth && window.localStorage.setItem(USER_AUTH,userAuth);
}

/**
 * 销毁用户身份存储
 */
export const destroyUserAuth = () => {
    window.localStorage.removeItem(USER_AUTH);
}

/**
 * 获取用户身份
 */
export const getUserAuth = () => {
    const userAuth = window.localStorage.getItem(USER_AUTH);
    if(userAuth == "undefined"){
        return null;
    }else {
        return userAuth;
    } 
}